package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppAuditWorkingPaper;
import com.ep.modules.app.service.AppAuditWorkingPaperService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/audit_working_paper")
public class AppAuditWorkingPaperController {
    @Autowired
    private AppAuditWorkingPaperService appAuditWorkingPaperService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appAuditWorkingPaperService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppAuditWorkingPaper appauditworkingpaper = appAuditWorkingPaperService.getById(id);
        return R.ok().put("appauditworkingpaper", appauditworkingpaper);
    }

    @SysLog("保存AppAuditWorkingPaper")
    @PostMapping("/save")
    public R save(@RequestBody AppAuditWorkingPaper appauditworkingpaper) {
        ValidatorUtils.validateEntity(appauditworkingpaper);
        appAuditWorkingPaperService.save(appauditworkingpaper);
        return R.ok();
    }

    @SysLog("修改AppAuditWorkingPaper")
    @PostMapping("/update")
    public R update(@RequestBody AppAuditWorkingPaper appauditworkingpaper) {
        ValidatorUtils.validateEntity(appauditworkingpaper);
        appAuditWorkingPaperService.update(appauditworkingpaper);
        return R.ok();
    }

    @SysLog("删除AppAuditWorkingPaper")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appAuditWorkingPaperService.deleteBatch(ids);
        return R.ok();
    }
}